package com.njlime.sys.entities;

import com.njlime.core.base.entities.BaseEntityPlus;
import com.njlime.core.web.validation.RegexType;
import com.njlime.core.web.validation.annotation.Validate;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

/**
 * 用户实体
 * Created by Dean on 2017-7-18.
 */
@Entity
@Table(name = "t_user")
public class User extends BaseEntityPlus {

    @Validate(description = "单位", nullable = false)
    private Integer unit_id; //单位ID

    @Validate(description = "登录名称", nullable = false)
    private String login_name; //登录名称

    @Validate(description = "密码", minLength = 6, nullable = false)
    private String password; //密码

    @Validate(description = "姓名", nullable = false)
    private String name; //姓名

    private String email; //邮件

    @Validate(description = "手机号",regexType= RegexType.PHONENUMBER,nullable = false)
    private String mobile; //手机

    private String qq;

    private Integer status; //状态 1可用 0禁用

    private String head_url; //头像地址

    private String openid; //微信

    private String login_ip; //最后登录IP

    private Date login_time; //最后登录时间

    private Integer login_flag; //是否允许登录（1是0否）

    private String id_card; //身份证号

    private String id_pic;//身份证照片

    @Transient
    private List<Role> roleList;
    @Transient
    private Unit unit;
    @Transient
    private Unit rootUnit;

    public Integer getUnit_id() {
        return unit_id;
    }

    public void setUnit_id(Integer unit_id) {
        this.unit_id = unit_id;
    }

    public String getLogin_name() {
        return login_name;
    }

    public void setLogin_name(String login_name) {
        this.login_name = login_name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getHead_url() {
        return head_url;
    }

    public void setHead_url(String head_url) {
        this.head_url = head_url;
    }

    public String getLogin_ip() {
        return login_ip;
    }

    public void setLogin_ip(String login_ip) {
        this.login_ip = login_ip;
    }

    public Date getLogin_time() {
        return login_time;
    }

    public void setLogin_time(Date login_time) {
        this.login_time = login_time;
    }

    public Integer getLogin_flag() {
        return login_flag;
    }

    public void setLogin_flag(Integer login_flag) {
        this.login_flag = login_flag;
    }

    public List<Role> getRoleList() {
        return roleList;
    }

    public void setRoleList(List<Role> roleList) {
        this.roleList = roleList;
    }

    public Unit getUnit() {
        return unit;
    }

    public void setUnit(Unit unit) {
        this.unit = unit;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public Unit getRootUnit() {
        return rootUnit;
    }

    public void setRootUnit(Unit rootUnit) {
        this.rootUnit = rootUnit;
    }

    public String getId_card() {
        return id_card;
    }

    public void setId_card(String id_card) {
        this.id_card = id_card;
    }

    public String getId_pic() {
        return id_pic;
    }

    public void setId_pic(String id_pic) {
        this.id_pic = id_pic;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }
}
